using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace AiPlatformAdmin.Api.Models;

public class Plugin : ITenantEntity
{
    public int Id { get; set; }

    [Required]
    public int TenantId { get; set; }

    [Required]
    [MaxLength(200)]
    public string Name { get; set; } = string.Empty;

    [MaxLength(1000)]
    public string? Description { get; set; }

    [Required]
    [MaxLength(50)]
    public string PluginType { get; set; } = "MCP"; // MCP, OpenAPI

    [Required]
    [MaxLength(50)]
    public string AuthMethod { get; set; } = "none"; // none, bearer, api_key, basic

    [MaxLength(500)]
    public string? Endpoint { get; set; } // Optional at plugin level

    [Column(TypeName = "jsonb")]
    public string? ParameterDefinitions { get; set; } // JSON array of parameter definitions: [{"name": "param1", "type": "string", "required": true}]

    public DateTime CreatedAt { get; set; } = DateTime.UtcNow;

    public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;

    // Navigation properties
    public Tenant? Tenant { get; set; }
    public ICollection<AgentPlugin> AgentPlugins { get; set; } = new List<AgentPlugin>();
}
